package com.knowledge.plus.other.mapstruct实体类转换.controller;

import com.knowledge.plus.other.mapstruct实体类转换.pojo.PersonDTO;
import com.knowledge.plus.other.mapstruct实体类转换.pojo.PersonDo;
import com.knowledge.plus.other.mapstruct实体类转换.converter.PersonConverter;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 详解请参考：https://segmentfault.com/a/1190000023576782?utm_source=sf-similar-article
 *
 * @author TPF
 * @since 2024/1/23
 */
@RestController
@RequestMapping("mapstruct")
public class ConverterController {

    @GetMapping("bean2bean")
    public void converterTest() {
        PersonDo personDo = new PersonDo();
        System.out.println(personDo);
        PersonDTO dto = PersonConverter.INSTANCE.personDo2Dto(personDo);
        System.out.println(dto);
    }

}
